package com.avertymaroc.library;

import com.avertymaroc.app.R;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.drawable.Drawable;

public class AlertDialogue extends AlertDialog{
	
	public static Builder builder;
	
	protected AlertDialogue(Context context ) {
		super(context);
	}
	public static void afficher(Context context , String message , String titre ,String btn_msg){
		builder = new Builder(context);
		builder.setPositiveButton(btn_msg, new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		});
		builder.setMessage(message)
				.setTitle(titre)
				.create()
				.show();
		
	}
	
	public static void afficher(Context context , String message , String titre ,String btn_msg, Drawable icon){
		builder = new Builder(context);
		builder.setPositiveButton(btn_msg, new DialogInterface.OnClickListener() {
				@Override
				public void onClick(DialogInterface dialog, int which) {
					dialog.dismiss();
				}
			});
		builder.setMessage(message)
				.setTitle(titre)
				.setIcon(icon)
				.create()
				.show();
		}
	public static void afficher(Context context , String message , String titre , DialogInterface.OnClickListener lisntenPos ,String messagePos ){
				builder = new Builder(context);
				builder.setPositiveButton(messagePos,lisntenPos );
				builder.setMessage(message)
				.setTitle(titre)
				.create()
				.show();
				}
	public static void afficher(Context context , String message , String titre , DialogInterface.OnClickListener lisntenPos 
											,String messagePos ,DialogInterface.OnClickListener lisntenNeg , String messageNeg ){
		builder = new Builder(context);
		builder.setPositiveButton(messagePos,lisntenPos );
		builder.setNegativeButton(messageNeg, lisntenNeg);
		builder.setMessage(message)
				.setTitle(titre)
				.create()
				.show();
		}
	
	public static void afficher(Context context , int message , int titre ,int btn_msg){
		builder = new Builder(context);
		builder.setPositiveButton(btn_msg, new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		});
		builder.setMessage(message)
				.setTitle(titre)
				.create()
				.show();
		
	}
	public static void afficher(Context context , String message , int titre ,int btn_msg){
		builder = new Builder(context);
		builder.setPositiveButton(btn_msg, new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		});
		builder.setMessage(message)
				.setTitle(titre)
				.create()
				.show();
		
	}
	public static void afficher(Context context , int message){
		builder = new Builder(context);
		builder.setPositiveButton(R.string.btn_ok, new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		});
		builder.setMessage(message)
				.setTitle(R.string.erreur)
				.create()
				.show();
		
	}
	public static void afficher(Context context , String message){
		builder = new Builder(context);
		builder.setPositiveButton(R.string.btn_ok, new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		});
		builder.setMessage(message)
				.setTitle(R.string.erreur)
				.create()
				.show();
		
	}
	
	public static void afficher(Context context , int resIdMsg , int resIdTitre ,int btn_msg, Drawable icon){
		builder = new Builder(context);
		builder.setPositiveButton(btn_msg, new DialogInterface.OnClickListener() {
				@Override
				public void onClick(DialogInterface dialog, int which) {
					dialog.dismiss();
				}
			});
		builder.setMessage(resIdMsg)
				.setTitle(resIdTitre)
				.setIcon(icon)
				.create()
				.show();
		}
	public static void afficher(Context context , int message , int titre , DialogInterface.OnClickListener lisntenPos ,int messagePos , Drawable icon ){
				builder = new Builder(context);
				builder.setPositiveButton(messagePos,lisntenPos );
				builder.setMessage(message)
				.setTitle(titre)
				.setIcon(icon)
				.create()
				.show();
				}
	public static void afficher(Context context , int message , int titre , DialogInterface.OnClickListener lisntenPos 
			,int messagePos ,DialogInterface.OnClickListener lisntenNeg , int messageNeg  ){
				builder = new Builder(context);
				builder.setPositiveButton(messagePos,lisntenPos );
				builder.setNegativeButton(messageNeg, lisntenNeg);
				builder.setMessage(message)
				.setTitle(titre)
				.create()
				.show();
				}
	public static void afficher(Context context , int message , int titre , DialogInterface.OnClickListener lisntenPos 
			,int messagePos ,DialogInterface.OnClickListener lisntenNeg , int messageNeg  , int icon){
				builder = new Builder(context);
				builder.setPositiveButton(messagePos,lisntenPos );
				builder.setNegativeButton(messageNeg, lisntenNeg);
				builder.setMessage(message)
				.setTitle(titre)
				.setIcon(icon)
				.create()
				.show();
				}

}
